﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DAL;

/// <summary>
/// Summary description for CateBO
/// </summary>
public class CateBO : DB_SAPDataContext
{
    public CateBO()
    {
        //
        // TODO: Add constructor logic here
        //
    }

    public List<ZD_PRC_ZD_COST_GROUP_GETBYIDResult> CostGroupGet(int Id)
    {
        try
        {
            return ZD_PRC_ZD_COST_GROUP_GETBYID(Id).ToList();

        }
        catch (Exception ex)
        {
            return null;
        }
    }
    public int CateCostInsert(ZD_CATE_COST obj)
    {
        try
        {
            return ZD_PRC_ZD_CATE_COST_INSERT(obj.NAME, obj.MA, obj.GHICHU, obj.ACTIVE, obj.CREATEUSER, obj.GROUPID);

        }
        catch
        {
            return -1;
        }
    }

    public bool CateCostUpdate(ZD_CATE_COST obj)
    {
        try
        {
            int result = ZD_PRC_ZD_CATE_COST_UPDATE(obj.ID, obj.NAME, obj.MA, obj.ACTIVE, obj.GHICHU, obj.UPDATEUSER, obj.GROUPID);
            if (result == 1)
                return true;
            else
                return false;
        }
        catch
        {
            return false;
        }
    }

    public List<ZD_PRC_ZD_CATE_COST_SEARCHResult> CateCostSearch(ZD_CATE_COST obj)
    {
        try
        {
            List<ZD_PRC_ZD_CATE_COST_SEARCHResult> result = new List<ZD_PRC_ZD_CATE_COST_SEARCHResult>();
            result = ZD_PRC_ZD_CATE_COST_SEARCH(obj.NAME, obj.MA, obj.ACTIVE, obj.GHICHU,obj.GROUPID).ToList();
            return result;
        }
        catch (Exception ex)
        {
            return null;
        }
    }
    public List<ZD_PRC_PHAPNHAN_GETBY_IDResult>GetPhapNhan(string Code)
    {
        try
        {
            List<ZD_PRC_PHAPNHAN_GETBY_IDResult> result = new List<ZD_PRC_PHAPNHAN_GETBY_IDResult>();
            result = ZD_PRC_PHAPNHAN_GETBY_ID(Code).ToList();
            return result;
        }
        catch (Exception ex)
        {
            return null;
        }
    }

    public List<ZD_PRC_SOVANDON_GETALLResult> GetSoVanDon()
    {
        try
        {
            List<ZD_PRC_SOVANDON_GETALLResult> result = new List<ZD_PRC_SOVANDON_GETALLResult>();
            result = ZD_PRC_SOVANDON_GETALL().ToList();
            return result;
        }
        catch (Exception ex)
        {
            return null;
        }
    }    
}